import { combineReducers } from 'redux';
import {calAction} from './types'
import {initBase} from './init'
import {calMethod} from './types'


const cal = (state=initBase, action:calAction) =>{
    switch (action.type){
        case calMethod.ADD:
            return state+action.payload
        case calMethod.MUL:
            return state*action.payload
        default:
            return state
    }
}

export default combineReducers({
    cal
})


